{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=319
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	i,n:longint;
	q,ans,a:extended;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(a,n);
ans:=1;
q:=1;
for i:=1 to n do begin
	q:=q*a;
	ans:=ans+q;
end;
write(ans);
end.